<?php

namespace App\Http\Controllers;

use App\Jobs\RedisJob;
use App\Models\Categories;
use Illuminate\Http\Request;

class TestController extends Controller
{
    public function queue()
    {
        $user = Categories::get()->toArray();

        RedisJob::dispatch($user);

        //延迟队列
        //RedisJob::dispatch($user)->delay(now()->addSeconds(15));

        //同步队列，立即处理，不需要放到队列里
        //RedisJob::dispatchNow($user);

        //指定队列名称onQueue
        //RedisJob::dispatch($user)->onQueue('order');

        //改为数据库存储队列
        //RedisJob::dispatch($user)->onConnection('database')->onQueue('order');


        return date('Y-m-d H:i:s') . "===处理完成了";
    }
}
